<?php

/**
 * QuestionAnswer form base class.
 *
 * @package    elearning
 * @subpackage form
 * @author     Your name here
 */
class BaseQuestionAnswerForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'id_question' => new sfWidgetFormPropelChoice(array('model' => 'Question', 'add_empty' => false)),
      'answer'      => new sfWidgetFormInput(),
      'true_answer' => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorPropelChoice(array('model' => 'QuestionAnswer', 'column' => 'id', 'required' => false)),
      'id_question' => new sfValidatorPropelChoice(array('model' => 'Question', 'column' => 'id')),
      'answer'      => new sfValidatorString(array('max_length' => 180)),
      'true_answer' => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('question_answer[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'QuestionAnswer';
  }


}
